<extend name="admin/main"/>

<block name="title">
    <title>banner列表</title>
</block>

<block name="css">
</block>

<block name="heading">banner列表</block>

<block name="content">
    <div class="row">
        <table class="table table-bordered table-hover">
            <tr>
                <th class="text-center">banner图片</th>
                <th class="text-center">banner链接</th>
                <th class="text-center">发布时间</th>
                <th class="text-center">更新时间</th>
                <th class="text-center">更新</th>
                <th class="text-center">删除</th>
            </tr>
            <foreach name="data" item="item" key="key">
                <tr>
                    <td class="text-center"><img src="{$item.src}" height="30px"></td>
                    <td class="text-center">{$item.link}</td>
                    <td class="text-center">{$item.updated_at}</td>
                    <td class="text-center">{$item.created_at}</td>
                    <td class="text-center"><a href="/admin/banner/update?id={$item.id}">更改</a></td>
                    <td class="text-center"><a href="/admin/banner/delete?id={$item.id}">删除</a></td>
                </tr>
            </foreach>
        </table>
    </div>

    <!--banner更新-->
    <notempty name="info">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-primary">
                    <div class="panel-heading">banner更新</div>
                    <div class="panel-body">
                        <form class="form-horizontal" method="post" action="/admin/banner/updates"
                              enctype="multipart/form-data">
                            <input type="hidden" name="id" value="{$id}">

                            <div class="form-group mb-md">
                                <label for="src" class="control-label">banner图片</label>
                                <div class="">
                                    <input type="file" class="form-control" id="src" name="src" required>
                                </div>
                            </div>

                            <div class="form-group mb-md">
                                <label for="link" class="control-label">banner链接</label>
                                <div class="">
                                    <input type="text" class="form-control" id="link" name="link" value="{$info.link}" required>
                                </div>
                            </div>

                            <div class="form-group mb-md  pull-right">
                                <button class="btn btn-block btn-success" type="submit">提交</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </notempty>

</block>
<block name="js">
    <script type="text/javascript" src="__PUBLIC__/assets/demo/demo.js"></script>
    <script type="text/javascript" src="__PUBLIC__/assets/demo/demo-switcher.js"></script>
    <script type="text/javascript" src="__PUBLIC__/assets/plugins/bootbox/bootbox.js"></script>
</block>

